Original: http://ntk2006.blog.sohu.com/135331235.html
Cursor ConceptCursors provide a flexible way to retrieve and operate data from tables. cursors are mainly used on servers to process SQL statements sent from clients to servers, or data
Recently, I used Godaddy space. Due to the large number of tables in the system, it was very troublesome to delete them one by one. I collected some solutions online.
To share with you:
1. Batch delete stored procedure declare @ procname
In practical applications, when we want to hand over a project to the customer, we need to clear all the previous test data of all tables in the database to give the customer a clean database, if there are many tables involved, it takes not only
This article describes how to batch clean up the content of a specified database in sqlserver. If you need it, refer to.
This article describes how to batch clean up the content of a specified database in sqlserver. If you need it, refer to.
[Recommended] (SqlServer) Batch cleanup all data in the specified database to establish a personal brand through knowledge sharing. In practical applications, when we want to hand over a project to the customer, we need to clear all the previous
In practical applications, when we want to hand over a project to the customer, we need to clear all the previous test data of all tables in the database to give the customer a clean database, if there are many tables involved, it takes not only
In practical applications, when we are ready to hand over a project to the customer for use, we need to clear all the tables in the library before the test data to give the customer a clean database, if the table involved a lot, to be emptied, not
1. Back up/restore the system database in the SQL Server database. The system information is stored in the system database. The main system databases include:
Master-controls user database and SQL server operations as a whole. After creating any
1. The first situation is the need to replace all the specified injection strings (replace only the injected string as empty)
Copy Code code as follows:
declare @delStr nvarchar (500)
Set @delStr = ' '--the field string injected here
/*
server|sqlserver| Create | statement
MS SQL Server can only get the creation statements for stored procedures as follows:
Sp_helptext procedurename
But often we need to get a table creation statement, for example, when the database upgrade to
In SQL Server, there are times when you need to give some logins (users) permission to view all or part of the objects (stored procedures, functions, views, tables) that define permissions to save. If a partial stored procedure, function, view is
Clear some of the sqlsever in the horse field, now summarize sqlsever batch replace database Hang horse field a text, hope can help people in need.
"Processing Method"
1, the first backup data to prevent the deletion of the horse field, the loss of
1. Bulk emptying of tables in the database delete (use caution)Use PL123EXEC sp_msforeachtable ' ALTER TABLE? NOCHECK CONSTRAINT All 'EXEC sp_msforeachtable ' ALTER TABLE? DISABLE TRIGGER All 'EXEC sp_msforeachtable ' DELETE from? 'EXEC
I collected, very useful1. Iterate through the cursor to update and delete data from the Memberaccount tableDECLARE my_cursor Cursor--Defines the cursor for (SELECT * FROM dbo. Memberaccount)--isolate the desired set into the cursor open my_cursor; -
In the MySQL database, use the cursor to traverse cyclically /*
Delete all data tables in the * dt database with empty docuemttype and MD, PD, and ET documenttype:
Delete from table name where length (documenttype) */
DELIMITER $
USE 'database name 1
I received a friend's question today. sqlserver reported that due to insufficient disk space in the DEFAULT file group, it was impossible to allocate a new page for the database TEMPDB. According to the error message, it should be due to
ERP reports are often made, involving reading data during the stored procedure, reading data associated with multiple tables, and using a cursor. Typical Example of reading a user table cursor
declare @ age int declare @ name varchar (20)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.